package com.gs.common.tool.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 日期工具类
 * @author: guos
 * @date: 2025/03/12 17:46
 **/
public class DateUtil {

    public static final String yyyyMMddHHmmss1 = "yyyyMMddHHmmss";

    public static final String yyyyMMddHHmmss2 = "yyyy-MM-dd HH:mm:ss";

    public static final String yyyyMMddHHmmss3 = "yyyy/MM/dd HH:mm:ss";

    public static final String yyyyMMdd1 = "yyyyMMdd";

    public static final String yyyyMMdd2 = "yyyy/MM/dd";

    public static final String yyyyMMdd3 = "yyyy-MM-dd";


    /**
     * 日期格式化
     * @param date    日期
     * @param fmt    格式
     * @date 2025/03/12 17:47
     **/
    public static String formatDate(Date date, String fmt) {
        SimpleDateFormat sdf = new SimpleDateFormat(fmt);
        return sdf.format(date);
    }
}
